Skip to content

msvc: hash profiles passed directly to clang-cl - #2962

Merged
sylvestre merged 3 commits into
mozilla:mainfrom
marcpems:fix/clang-cl-profile-cache
Nov 20, 2026
Merged

sylvestre merged 3 commits into
mozilla:mainfrom
marcpems:fix/clang-cl-profile-cache

Conversation

@marcpems

@marcpems marcpems commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This change addresses a gap in the handling of PGO file names for clang-cl only. Discovered with the Rust project, where changing the PGO handing did not force a cache miss.

Resolves #2964

Both the missing commands for instrumenting and using profile data have been added.
Simple test to validate flag support included.

cargo fmt -- --check - Passed
cargo clippy --locked --all-targets -- -D warnings -A unknown-lints -A clippy::type_complexity -A - Passed
cargo test --locked --lib --bins --tests  - 621 passed, 0 failed, 1 ignored

@marcpems
marcpems marked this pull request as ready for review October 28, 2026 13:03
@marcpems

Copy link
Copy Markdown
Contributor Author

@sylvestre please could you take a look?
this is related to work to re-enable Rust PGO for x64, here rust-lang/rust#164707

@codecov-commenter

codecov-commenter commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.96%. Comparing base (43c90af) to head (13a0a85).

Files with missing lines Patch % Lines
src/compiler/msvc.rs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2962      +/-   ##
==========================================
- Coverage   79.16%   78.96%   -0.21%     
==========================================
  Files          75       75              
  Lines       46166    46158       -8     
==========================================
- Hits        36548    36449      -99     
- Misses       9618     9709      +91     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

marcpems and others added 2 commits November 10, 2026 16:59
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sylvestre
sylvestre force-pushed the fix/clang-cl-profile-cache branch from f95a9a3 to 319bd1a Compare November 10, 2026 15:59
Comment thread src/compiler/msvc.rs
msvc_take_arg!("fp:", OsString, Concatenated, PassThroughWithSuffix),
msvc_take_arg!("fpcvt:", OsString, Concatenated, PassThroughWithSuffix),
msvc_take_arg!("fprofile-instr-use", PathBuf, Concatenated(b'='), ClangProfileUse),
msvc_take_arg!("fprofile-use", PathBuf, Concatenated(b'='), ClangProfileUse),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about -fprofile-instr-generate passed directly? it still won't set profile_generate like the -clang: path does.
could be a follow-up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see new PR #3074

Comment thread src/compiler/msvc.rs
Some(ClangProfileUse(path)) if is_clang => {
extra_hash_files.push(clang::resolve_profile_use_path(path, cwd));
}
Some(ClangProfileUse(_)) => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be merged with the ClangModuleFile(_) | ClangModuleOutput(_) | ClangLanguage(_) arm below, no?

follow up is fine too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, see PR #3074

@sylvestre
sylvestre merged commit 73ec393 into mozilla:main Nov 20, 2026
51 checks passed
@sylvestre

Copy link
Copy Markdown
Collaborator

Thanks for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invoking clang-cl with pgo profile parameters omits the file content in the hash key

3 participants